/**
 * 
 */
package edu.hawaii.webspider;


import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import org.junit.Test; 

/**
 * @author kenglish
 *
 */
public class TestWebSpiderExample {

  
  /**
   * Test the web spider for a website.
   * @throws Exception if problems occur within WebSpider.
   */
  @Test
  public void testGetNumLinks() throws Exception {
    WebSpiderExample example = new WebSpiderExample("http://www.httpunit.org");
    assertTrue("Should have more than 0 links", example.getNumLinks() > 0 ) ;
  }
  /**
   * Test the web spider for a known website: kenglish77.com which only has 31 links.
   * Also does a mundane test of WebSpiderExample.main()
   * @throws Exception if problems occur within WebSpider.
   */
  @Test
  public void testGetNumLinksKnown() throws Exception {
    WebSpiderExample example = new WebSpiderExample("http://www.kenglish77.com");
    assertEquals("kenglish77.com only has 31 links",31, example.getNumLinks()) ;
    // Test main to ensure that we get 100 % cover.
    WebSpiderExample.main(new String[1]);    
  }  
  

}
